package com.iris.live.services.data.repositories;

import com.iris.live.services.data.models.Lsh保险战败原因Model;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by sxy on 2016/7/11
 */
public interface Lsh保险战败原因Repository extends JpaRepository<Lsh保险战败原因Model, Integer>, JpaSpecificationExecutor<Lsh保险战败原因Model> {

    @Modifying
    @Query("update Lsh保险战败原因Model u set u.启用状态 = ?2 where u.新保战败原因编号 = ?1")
    int set启用状态By新保战败原因编号(int id, String status);

    @Query("select u from Lsh保险战败原因Model u where u.新保战败原因编号=?1")
    Lsh保险战败原因Model findByid(Integer id);

    @Query("select u from Lsh保险战败原因Model u where u.启用状态='启用' and (u.许可=?1 or u.许可='LSH')")
    List<Lsh保险战败原因Model> findListByPermit(String permit);
}
